package com.youlv.yl.api;

import com.youlv.yl.bo.SmsCodeBo;
import com.youlv.yl.manager.intf.AliSmsService;
import com.youlv.yl.vo.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author fenghe
 * @date 2022/1/2 8:51
 */
@RestController
@RequestMapping("/api/sms/")
@Api(value = "实现短信的相关操作", tags = "实现短信的相关操作")
/**  跨域*/
@CrossOrigin
public class AliSmsController {
    @Autowired
    private AliSmsService service;

    /** 请求注册验证码*/
    @PostMapping("sendrcode.do")
    public R sendRCode(@RequestBody SmsCodeBo bo) {
        return service.sendRCode(bo.getPhone());
    }

    /** 请求登陆验证码*/
    @PostMapping("sendlcode.do")
    public R sendLCode(@RequestBody SmsCodeBo bo) {
        return service.sendLCode(bo.getPhone());
    }

    /** 请求密码找回验证码*/
    @PostMapping("sendfcode.do")
    public R sendFCode(@RequestBody SmsCodeBo bo) {
        return service.sendFCode(bo.getPhone());
    }

    /** 注册验证码校验*/
    @PostMapping("checkrcode.do")
    public R CheckRCode(@RequestBody SmsCodeBo bo) {
        return service.checkRCode(bo);
    }

    /** 登陆验证码校验*/
    @PostMapping("checklcode.do")
    public R CheckLCode(@RequestBody SmsCodeBo bo) {
        return service.checkLCode(bo);
    }

    /** 密码找回验证码校验*/
    @PostMapping("checkfcode.do")
    public R CheckFCode(@RequestBody SmsCodeBo bo) {
        return service.checkFCode(bo);
    }
}
